package cn.wolfcode.mapper;

import cn.wolfcode.domain.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
@Select("""
        select  id, name, create_time, update_time from dept
          order by update_time desc 
        """)
    List<Dept> getAll();
@Delete("""
        delete from dept where id=#{id}
        """)
    void delete(Long id);
@Insert(
        """
                insert into dept( name, create_time, update_time) 
                values(
                  #{name},now(),now()
                
                ) 
                """
)
    void add(Dept dept);
@Update("""
        update boss.dept
        set
            boss.dept.name=#{name},
            boss.dept.update_time=now()
        where boss.dept.id=#{id}
        """)
    void updata(Dept dept);
@Select("""
        select * from  boss.dept where id=#{id};
        """)
    Dept selectOneById(Long id);
}
